const router = require('express').Router()

const { testLogin, testId, testAdd } = require('../middleware/users')

const { avatarStorage } = require('../../oa_server/utils/multer')

const { login, register, info, update, rpwd } = require('../controllers/users')

router.post('/login', testLogin, login)

router.post('/register', testLogin, register)

router.get('/info/:id', testId, info)
router.get('/info', testId, info)
router.post('/update', avatarStorage.single('avatar'), testAdd, testId, update)

router.post('/rpwd', testId, rpwd)
module.exports = router